package com.cebbank.group.demoweb.bean;

import com.cebbank.group.demoweb.config.DateFormatJsonSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;

public class MyBean {
    @Min(value = 1L,message = "age 不能小于等于0")
    private int age;
    @NotNull(message = "name 不能为空")
    private String name;
    @NotNull(message = "date 不能为空")
    private Date date;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @JsonSerialize(using = DateFormatJsonSerializer.class)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return "MyBean{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", date=" + date +
                '}';
    }
}
